package my.p2p.client.util;

import java.nio.ByteBuffer;

public class ByteUtils {

    public static byte[] long2Byte(long x) {
        ByteBuffer buffer = ByteBuffer.allocate(8);
        buffer.putLong(0, x);
        return buffer.array();
    }

    public static long byte2Long(byte[] bb) {
        ByteBuffer buffer = ByteBuffer.allocate(8);
        buffer.put(bb);
        buffer.flip();
        return buffer.getLong();
    }

}
